#ifndef _DISP_OPENGLDISP_H_
#define _DISP_OPENGLDISP_H_

#include "Camera.h"
#include "Light.h"
#include "LightManager.h"
#include "Material.h"

#include "../geometry/StrokeManager.h"
#include "SketchPaint.h"

#include "../AnalyticDrawingDoc.h"
#include "../AnalyticDrawingView.h"

class CAnalyticDrawingView;
class CAnalyticDrawingDoc;

//	inline function

inline void DrawVertex(CVertex3D p)
{
	glVertex3d(p.m_data[0], p.m_data[1], p.m_data[2]);
}

class COpenGLDisplay
{
public:
	COpenGLDisplay(CAnalyticDrawingView* pView);
	~COpenGLDisplay();

	CCamera* GetCamera() {return &m_camera;}
	CLight* GetLight(int index) {return m_lightManager.GetLight(index);}
	CMaterial* GetMaterial() {return &m_material;}
	CLightManager* GetLightManeger() {return &m_lightManager;}
	CStrokeManager* GetStrokeManager() {return &m_strokeManager;}
	CSketchPaint* GetSketchPaint() {return &m_paint;}

	void InitRenderParas();
	void RenderScene(bool isWireModel);

	CAnalyticDrawingView* GetParentView() {return m_pView;}

protected:
	void RenderSceneWithWire();
	void RenderScenceWithLight();

	void RenderStroke();
	void RenderPoint();
	void RenderLineSegment();
	void RenderScaffold();
	void RenderSurfaces();
	void RenderCurve();
	void RenderActiveVertex();
private:
	CCamera m_camera;
	//CLight m_light;
	CLightManager m_lightManager;
	CMaterial m_material;

	CStrokeManager m_strokeManager;
	CAnalyticDrawingView* m_pView;
	CSketchPaint m_paint;

	void RenderSingleSurface(int surfaceIndex);
};

#endif